package model

import (
	"gitee.com/xuxinzhi2206/corehub/database/mysql"
	"gorm.io/gorm"
)

type Order struct {
	gorm.Model
	OrderId     int64  `gorm:"type:int(11);comment:订单id"`
	GoodsId     int64  `gorm:"type:int(11);comment:商品id"`
	OrderNumber string `gorm:"type:varchar(255); comment:订单编号"`
}

func (o *Order) CreateOrder() error {
	return mysql.WithMysql(func(db *gorm.DB) error {
		return db.Create(o).Error
	})
}
func (o *Order) GetOrder() ([]Order, error) {
	var list []Order
	return list, mysql.WithMysql(func(db *gorm.DB) error {
		return db.Find(&list).Error
	})
}
